home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / MacPerl 5.1.3 / Mac_Perl_513_src / MacPerl5 / MPGlobals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-18  |  7.3 KB  |  353 lines  |  [TEXT/MPS ]

  1. /*********************************************************************
  2. Project    :    MacPerl                -    Real Perl Application
  3. File        :    MPGlobals.h    -
  4. Author    :    Matthias Neeracher
  5.  
  6. A lot of this code is borrowed from 7Edit written by
  7. Apple Developer Support UK
  8.  
  9. Language    :    MPW C
  10.  
  11. $Log: MPGlobals.h,v $
  12. Revision 1.2  1994/05/04  02:51:46  neeri
  13. Inline Input.
  14.  
  15. Revision 1.1  1994/02/27  23:03:27  neeri
  16. Initial revision
  17.  
  18. Revision 0.5  1993/12/12  00:00:00  neeri
  19. PerlPrefs, SacrificalGoat
  20.  
  21. Revision 0.4  1993/08/17  00:00:00  neeri
  22. LibraryPaths
  23.  
  24. Revision 0.3  1993/08/05  00:00:00  neeri
  25. Small icons
  26.  
  27. Revision 0.2  1993/05/29  00:00:00  neeri
  28. Support console windows
  29.  
  30. Revision 0.1  1993/05/29  00:00:00  neeri
  31. Compiles correctly
  32.  
  33. *********************************************************************/
  34.  
  35. #ifndef __MPGLOBALS__
  36. #define __MPGLOBALS__
  37.  
  38. #include <Types.h>
  39. #include <QuickDraw.h>
  40. #include <Menus.h>
  41. #ifdef EVIL_USELESS_EDITIONS
  42. #include <Editions.h>
  43. #endif
  44. #include <Printing.h>
  45. #include <AppleEvents.h>
  46. #include <TextServices.h>
  47. #include <TSMTE.h>
  48. #include <ICAPI.h>
  49. #include <setjmp.h>
  50.  
  51. #define MAC_CONTEXT
  52. #include "macish.h"
  53.  
  54. #include "MPRsrc.h"
  55.  
  56. #ifndef EXTERN
  57. #define EXTERN extern 
  58. #define INIT(x)
  59. #endif
  60.  
  61. #define  PerlWindowKind    5146
  62.  
  63. #define    LibraryPaths    128
  64.  
  65. /*
  66.     Items in Apple Menu
  67. */
  68.  
  69. #define  aboutItem  1
  70.  
  71. /*
  72.     Items in File Menu
  73. */
  74.  
  75. #define  fmNew                    1
  76. #define  fmOpen                2
  77. #define  fmClose                4
  78. #define  fmSave                5
  79. #define  fmSaveAs                6
  80. #define  fmRevert                7
  81. #define  fmPageSetUp            9
  82. #define  fmPrint                10
  83. #define  fmQuit                12
  84.  
  85. /*
  86.     Items in Edit Menu
  87. */
  88. #define  undoCommand            1
  89. #define  cutCommand             3
  90. #define  copyCommand         4
  91. #define  pasteCommand         5
  92. #define  clearCommand         6
  93. #define  selectAllCommand     7
  94.  
  95. #define    emJumpTo                9
  96. #define    emFormat                11
  97.  
  98. #ifdef EVIL_USELESS_EDITIONS
  99. #define  cPublisher           13
  100. #define  cSubscriber          14
  101. #define  cOptions             15
  102. #define  cBorders             16
  103.  
  104. #define    emPreferences        18
  105. #else
  106. #define    emPreferences        13
  107. #endif
  108.  
  109. /* 
  110.     Items in Editor Menu 
  111. */
  112. #define    xmEdit            1
  113. #define    xmEditFront        2
  114. #define     xmUpdate            4
  115. #define     xmUpdateFront    5
  116.  
  117. /*
  118.     Items in Perl Menu
  119. */
  120. #define    pmRun                1
  121. #define    pmRunFront        2
  122. #define    pmCheckSyntax    3
  123. #define    pmCheckFront    4
  124. #define    pmWarnings        6
  125. #define    pmDebug            7
  126. #define    pmStandard        9
  127.  
  128. /*
  129.     Item in Help Menu
  130. */
  131. #define    hmExplain        5
  132.  
  133. /*
  134.     Entry of Menu in myMenus
  135. */
  136. #define  appleM             0
  137. #define  fileM              1
  138. #define  editM              2
  139. #define    windowM            3
  140. #define    editorM            4
  141. #define    perlM                5
  142. #define    helpM                6
  143. #define  kLastMenu        6
  144.  
  145. /*
  146.     Save Changes Dialog Items
  147. */
  148.  
  149. #define  aaSave              1
  150. #define  aaDiscard          2
  151. #define  aaCancel         3
  152.  
  153. #define  kOSEvent                       app4Evt    /*event used by MultiFinder*/
  154. #define  kSuspendResumeMessage        1        /*high byte of suspend/resume event message*/
  155. #define  kResumeMask                         1        /*bit of message field for resume vs. suspend*/
  156. #define  kMouseMovedMessage              0xFA    /*high byte of mouse-moved event message*/
  157. #define  kNoEvents                         0        /*no events mask*/
  158.  
  159. /* How much memory to set aside for emergencies */
  160.  
  161. #define SACRIFICE        65536
  162.  
  163. /* File too bulky for TextEdit */
  164.  
  165. #define elvisErr        666
  166.  
  167. #ifdef EVIL_USELESS_EDITIONS
  168. /*
  169.     this is a section record to hold the information about
  170.     the publishers and subscribers in this document
  171. */
  172.  
  173. struct SectRec {
  174.     SectionHandle   fSectHandle;
  175.     short           fSectionID;
  176.     RgnHandle       fBorderRgn; /*handle to the outside border*/
  177.     Rect            fInnerBounds;
  178.     short           fStart;     /*fStart and fEnd are both specific to a*/
  179.     short           fEnd;       /*text handling application- start and end of text selection*/
  180.     struct SectRec  **fNextSection;
  181.     FSSpec          fFSSpec;
  182.     short           fCount;
  183.     Handle          fTextHandle;
  184.     Boolean         fChanged; /*has the section been changed*/
  185.     struct DocRec   *fDocument;
  186. };
  187.  
  188. typedef struct SectRec SectRec;
  189. typedef SectRec *SectPtr, **SectHandle;
  190. #endif
  191.  
  192. typedef enum {
  193.     kDocumentWindow,
  194.     kWorksheetWindow,
  195.     kConsoleWindow
  196. } WindowKind;
  197.  
  198. #if defined(powerc) || defined (__powerc)
  199. #pragma options align=mac68k
  200. #endif
  201.  
  202. typedef struct RegularDoc {
  203.     Boolean          showBorders;
  204.     Boolean        everSaved;
  205.     Boolean            everLoaded;
  206. #ifdef EVIL_USELESS_EDITIONS
  207.     SectHandle       firstSection; /*the first section in the list*/
  208.     SectHandle       lastSection;  /*the last section*/
  209.     short          numSections;
  210.     short          lastID;      /*the last sectionID*/
  211. #endif
  212.     FSSpec             origFSSpec;
  213. } RegularDoc;
  214.  
  215. struct DocRec;
  216.  
  217. typedef struct ConsoleDoc {
  218.     struct DocRec *next;
  219.     Ptr                cookie;
  220.     short                memory;
  221.     short                fence;
  222.     Boolean            selected;
  223. } ConsoleDoc;
  224.  
  225. enum {
  226.     stateConsole = 0x0001,
  227.     stateDocument= 0x0002,
  228.     stateRdWr    = 0x0010,
  229.     stateRdOnly  = 0x0020,
  230.     stateBlocked = 0x0030
  231. };
  232.  
  233. enum {
  234.     kPreferenceDoc = 'pref',
  235.     kPlainTextDoc    = 'TEXT',
  236.     kScriptDoc        = 'SCPT',
  237.     kRuntime7Doc    = 'MrP7',
  238.     kOldRuntime6Doc= 'OlP6',
  239.     kUnknownDoc        = '\?\?\?\?'
  240. };
  241.  
  242. typedef OSType    DocType;
  243.  
  244. struct DocRec {
  245.     TEHandle       theText;
  246.     ControlHandle  vScrollBar;
  247.     ControlHandle  hScrollBar;
  248.     WindowPtr      theWindow;
  249.     short          refNum;
  250.     short                lastState;
  251.     Str255         theFileName;
  252.     FSSpec           theFSSpec;
  253.     THPrint        thePrintSetup;
  254.     Rect           pageSize;    /*From thePrintSetUp^^.prInfo.rPage but 0 offset*/
  255.     Boolean        dirty;
  256.     Boolean            inDataFork;
  257.     WindowKind        kind;
  258.     DocType            type;
  259.     TSMTERecHandle    tsmTERecHandle;
  260.     TSMDocumentID    tsmDoc;
  261.     union {
  262.         RegularDoc    reg;
  263.         ConsoleDoc    cons;
  264.     } u;
  265. };
  266.  
  267. typedef struct DocRec DocRec;
  268. typedef DocRec *DPtr;
  269.  
  270. struct HeaderRec {
  271.     Rect        theRect;
  272.     Str255   theFont;
  273.     short        theSize;
  274.     short    theLength;
  275.     short    numSections;
  276.     short    lastID;
  277. };
  278.  
  279. typedef struct HeaderRec HeaderRec;
  280.  
  281. typedef HeaderRec *HPtr, **HHandle;
  282.  
  283. struct DocFormat {
  284.     short        font;
  285.     short        size;
  286. };
  287.  
  288. typedef struct DocFormat DocFormat;
  289.  
  290. struct PerlPrefs    {
  291.     short        version;
  292. #define PerlPrefVersion411    0
  293. #define PerlPrefVersion413    1
  294. #define PerlPrefVersion500 2
  295.     Boolean    runFinderOpens;
  296.     Boolean    checkType;
  297.     Boolean    inlineInput;
  298. };
  299.  
  300. typedef struct PerlPrefs PerlPrefs;
  301.  
  302. #if defined(powerc) || defined (__powerc)
  303. #pragma options align=reset
  304. #endif
  305.  
  306. EXTERN short              gWCount;
  307. EXTERN short              gNewDocCount;
  308. EXTERN MenuHandle         myMenus[kLastMenu+1];
  309. EXTERN short              gFontMItem;
  310. EXTERN Boolean            gQuitting;
  311. EXTERN Boolean                gWarnings;
  312. EXTERN Boolean                gDebug;
  313. EXTERN Boolean            gInBackground;
  314. EXTERN Boolean                gRunningPerl;
  315. EXTERN Boolean                gRemoteControl;
  316. EXTERN Cursor             editCursor;
  317. EXTERN Cursor             waitCursor;
  318. EXTERN DPtr                    gConsoleList;
  319. EXTERN short                gPrefsFile;
  320. EXTERN short                gScriptFile;
  321. EXTERN WindowPtr            gActiveWindow;
  322. MP_EXT short                gAppFile;
  323. MP_EXT short                gAppVol;
  324. MP_EXT long                    gAppDir;
  325. EXTERN DocFormat            gFormat;
  326. EXTERN Handle                gRuntimeScript;
  327. EXTERN Handle                gPseudoFile;
  328. EXTERN AppleEvent **        gWaitingScripts;
  329. EXTERN DPtr                    gGotEof;
  330. EXTERN PerlPrefs            gPerlPrefs;
  331. MP_EXT Handle                gSacrificialGoat;
  332. EXTERN jmp_buf                gExitPerl;
  333. EXTERN AppleEvent            gDelayedScript;
  334. EXTERN short                gCompletedScripts;
  335. EXTERN long                 gSavedFontForce;
  336. EXTERN ICAppSpecHandle    gExternalEditor;
  337. EXTERN Handle                gCachedLibraries;
  338.  
  339.   /*now for the environment variables set up by Gestalt*/
  340.  
  341. EXTERN Boolean    gAppleEventsImplemented;
  342.  
  343. EXTERN Boolean    gAliasManagerImplemented;
  344. #ifdef EVIL_USELESS_EDITIONS
  345. EXTERN Boolean    gEditionManagerImplemented;
  346. #endif
  347. EXTERN Boolean    gOutlineFontsImplemented;
  348. EXTERN Boolean    gRecordingImplemented;
  349. EXTERN Boolean        gTextServicesImplemented;
  350. EXTERN Boolean        gTSMTEImplemented;
  351. EXTERN ICInstance    gICInstance;
  352.  
  353. #endif